<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="kaiji">
    <meta name="keyword" content="权限, 博客, 信息, 列表">
    <title>权限信息列表</title>
	<#include "admin/common.ftl" />
	
	<style type="text/css">
		.form-control {color: black;}
	</style>
  </head>

  <body>

  <section id="container" class="">
      <!--header start-->
      <#include "admin/header.ftl" />
      <!--header end-->
      <!--sidebar start-->
      <#include "admin/sidebar.ftl" />
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
            <div class="row">
              <div class="col-lg-12">
                  <section class="panel">
                      <header class="panel-heading">权限信息</header>
                      <div class="panel-body">
                          <form id="editForm" role="form" class="form-horizontal tasi-form" action="${ctx}/admin/jur/<#if jur??>update<#else>save</#if>.html" method="POST">
                          	 <input type="hidden" name="jurisdictionId" value="${(jur.jurisdictionId)}" />
                              <div class="form-group">
                                <label class="control-label col-lg-2" for="parentId">顶级菜单</label>
				          	    <div class="col-lg-10">
				          	    	  <select name="parentId">
				          	    	  	<option value="0">顶级菜单</option>
				          	    	    <#list jurTopList as jurTop>
				          	    	    <option value="${(jurTop.jurisdictionId)}" <#if jur.parentId == jurTop.jurisdictionId>selected="selected" </#if>>${jurTop.name}</option>
				          	    	    </#list>
				          	    	  </select>
				          	    </div>
                              </div>
							  <div class="form-group">
							    <label class="control-label col-sm-2" for="code" >编码</label>
							    <div class="col-sm-5">
							      <input name="code" value="${(jur.code)}" class="form-control" type="text" />
							    </div>
							  </div>
							  <div class="form-group">
							    <label class="control-label col-sm-2" for="url" >地址</label>
							    <div class="col-sm-5">
							      <input name="url" value="${(jur.url)}" class="form-control" type="text" />
							    </div>
							  </div>
							  <div class="form-group">
							    <label class="control-label col-sm-2" for="name" >名称</label>
							    <div class="col-sm-5">
							      <input name="name" value="${(jur.name)}" class="form-control" type="text" />
							    </div>
							  </div>
                              <div class="form-group">
                                  <div class="col-lg-offset-2 col-lg-10">
                                      <button class="btn btn-danger" type="submit">保存</button>
                                      <button class="btn" type="button" onClick="javascript:history.go(-1);">返回</button>
                                  </div>
                              </div>
                          </form>
                      </div>
                  </section>
              </div>
          </div>
	  </section>
  <!--main content end-->
 </section>

<#include "admin/common_js.ftl" />
<script src="${ctx}/js/jquery.validate.min.js" ></script>
<script type="text/javascript">
$("#editForm").validate({
  rules:{
  	"parentId": {required: true},
  	"name": {required: true},
  	"code": {required:true}
  },
  messages: {
  	"parentId": {required: "请选择上级菜单"},
  	"name": {required: "请输入名称"},
  	"code": {required: "请输入编码"}
  }, 
  submitHandler: function(form){
    $.ajax({
    		url: $(form).attr("action"),
		data: $("#editForm").serialize(),
        type: "post",
        dataType: "json",
        success: function(data) {
            	if (data.success == 0) {
				layer.alert(data.message, {icon: 5});
            	} else {
            		location.href = "${ctx}/admin/jur/list.html";
            	}
        }
    });
  }

});
</script>
  </body>
</html>